
function scrollToLocation(location) {
    
    if(location != 'undefined') {
        if(isNumber(location)) {
           $('html,body').animate({scrollTop: location }); 
        } else {
           $('html,body').animate({scrollTop: $("#"+location).offset().top }); 
        }
    } else {
        $('html,body').animate({scrollTop: 0 });
    }
    
}

function isNumber(n) {
    return !isNaN(parseFloat(n)) && isFinite(n);
}